#ifndef CAMERA_H
#define CAMERA_H

#include <GLFW/glfw3.h>

#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/trigonometric.hpp>

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>

bool keys[1024];

class camera{
    //position of the camera
    glm::vec3 position;
    //direction in which camera is pointing
    glm::vec3 direction;
    //target which its pointing
    //coord camera system
    glm::vec3 right;
    glm::vec3 up;
    //lookAt matrix
    glm::mat4 view;
    //camera movement speed
    float cameraSpeed;
    float sensitivity;
    //euler angles for camera rotation
    float pitch, yaw, roll;

    //camera movement
    float lastx, lasty;

public:
    camera();
    camera(const glm::vec3 &pos);
   
    //getters

    const glm::vec3 getPosition() const;
    const glm::vec3 getDirection() const;
    //matrix lookAt 
    const glm::mat4 getView()const;
    //camera speed movement and radius of rotation
    const float &getSensitivity() const;
    const float &getCamSp() const;
    const glm::vec3 &getUp() const;
    //euler angles for camera rotation
    const float &getPitch() const;
    const float &getYaw() const;
    const float &getRoll() const;

    const float &getLastx() const;
    const float &getLasty() const;
    
    
    //setters

    void setTarget(const glm::vec3 &tar);
    void setPos(const glm::vec3 &pos);
    void setView(const glm::mat4 &vi);
    //camera speed
    void setCamSp(const float &camSp);
    //camera coord system
    void setUp(const glm::vec3 &up);
    void setSensitivity(const float& sen);
    void setDirection(const glm::vec3 & dir);
    void setDirectionCoords(const float &x, const float &y, const float &z);
    //euler angles
    void setPitch(const float &p);
    void setYaw(const float &y);
    void setRoll(const float &r);

    void setLastx(const float &lastx) ;
    void setLasty(const float &lasty) ;

    //operations

    //updates view space matrix
    void updateCameraCoord();
    //keyboard input
    void do_movement();
    //mause input
    void mouseInput(GLFWwindow *window) const;

private:
    camera(const camera &cam);
    
};

#endif
